package thread.sleep.filemove;

import java.io.File;

public class FileMoveThread extends Thread {
	@Override
	public void run() {

		File newDir = new File("c:\\day\\newDir");
		File newDir2 = new File("c:\\day\\newDir2");
		
		while(newDir.exists()) {
			try {
				Thread.sleep(5000);
			} catch (Exception e) {
				e.printStackTrace();
			}

			String[] list = newDir.list();

			for (String s : list) {
				System.out.println(s);
				File file = new File("c:\\day\\newDir", s);
				File newFile = new File("c:\\day\\newDir2", s);

				file.renameTo(newFile);
			}
		}

	}
}
